//https://www.npmjs.com/package/path-to-regexp
//
//https://jex.im/regulex/#!flags=&re=%5E(a%7Cb)*%3F%24

/*
sensitive 是否大小写敏感 (默认值: false)
strict 是否允许结尾有一个可选的/ (默认值: false)
end 是否匹配整个字符串 (默认值: true)
*/
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { pathToRegexp, Key } = require('path-to-regexp');

const regxp = pathToRegexp('/home',[],{end:true});
console.log(regxp);//   /^\/home[\/#\?]?$/i

console.log(regxp.test('/home/2')); //false
console.log(regxp.test('/home#')); //true
console.log(regxp.test('/home?')); //true
console.log(regxp.test('/home/')); //true

const regExp2 = pathToRegexp('/home',[],{end:false});
console.log(regExp2);//  /^\/home(?:[\/#\?](?=[]|$))?(?=[\/#\?]|[]|$)/i
console.log(regExp2.test('/home')); //true
console.log(regExp2.test('/home/')); //true
console.log(regExp2.test('/home//')); //true
console.log(regExp2.test('/home/2')); //true
